from web_server_function.CourseServer import course_server
from web_server_function.UserServer import user_server
from web_server_function.ServerUtils import server_utils
from utils.ReadUtil import read_util
import argparse


def audit_course_change(customer_service_name, orders_no, want_courses):
    # 订单对应客服登录
    server_utils.login_background(read_util.read_data()['后台账号密码'][f'{customer_service_name}账号'],
                                  read_util.read_data()['后台账号密码'][f'{customer_service_name}密码'])

    # 添加换课申请
    print(course_server.courseChange_addUpdate(orders_no, want_courses))
    # 审核换课申请
    course_server.peopleAudit_courseChange(orders_no)


if __name__ == '__main__':
    parser = argparse.ArgumentParser(description='执行审核换课申请操作')
    parser.add_argument('customer_service_name', type=str, help='客服名字')
    parser.add_argument('orders_no', type=str, help='订单编号')
    parser.add_argument('want_courses', type=str, help='希望换的课程名')
    args = parser.parse_args()

    audit_course_change(args.customer_service_name, args.orders_no, args.want_courses)
